/*
 * Application.h
 *
 *  Created on: 2018年7月25日
 *      Author: terry
 */

#ifndef APPLICATION_H_
#define APPLICATION_H_

#include "PlayerHolder.h"
#include "TMap.h"

#include "MediaWriter.h"

typedef std::shared_ptr< av::MediaWriter >		MediaWriterPtr;


class Application
{
public:
	static Application& instance();

public:
	Application();
	virtual ~Application();

	int init();

	void quit();

	void clear();

	void put(HANDLE handle, PlayerHolderPtr& player);

	PlayerHolderPtr remove(HANDLE handle);

	PlayerHolderPtr get(HANDLE handle);


	void clearWriter();

	void putWriter(HANDLE handle, MediaWriterPtr& writer);

	MediaWriterPtr removeWriter(HANDLE handle);

	MediaWriterPtr getWriter(HANDLE handle);


	typedef comn::Map<HANDLE, PlayerHolderPtr>	PlayerMap;

	typedef comn::Map<HANDLE, MediaWriterPtr>	WriterMap;

	PlayerMap	m_playerMap;
	
	WriterMap	m_writerMap;

protected:

};

#endif /* APPLICATION_H_ */
